import { https } from '../utils/https'
import type { AddressParams, AddressItem } from '../types/address'
// 新建收货地址
export const postMemberAddressAPI = (data: AddressParams) => {
  return https({
    method: 'POST',
    url: '/member/address',
    data,
  })
}
// 虎丘收货地址列表
export const getMemberAddressAPI = () => {
  return https<AddressItem[]>({
    method: 'GET',
    url: '/member/address',
  })
}
// 获取收货地址详情
export const getMemberAddressByIdAPI = (id: string) => {
  return https<AddressItem>({
    method: 'GET',
    url: `/member/address/${id}`,
  })
}
// 修改收货地址
export const putMemberAddressByIdAPI = (id: string, data: AddressParams) => {
  return https<AddressItem>({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}
// 删除收货地址
export const deleteMemberAddressByIdAPI = (id: string) => {
  return https({
    method: 'DELETE',
    url: `/member/address/${id}`,
  })
}
